<%@ page import="java.util.List" %>
<%@ page import="com.health.pojo.ExamineOrder" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%--使用EL表达式--%>
<%@page isELIgnored="false" %>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>欢迎来到 Renew！</title>
</head>
<link rel="stylesheet" type="text/css" href="../css/main.css">
<link rel="stylesheet" type="text/css" href="../css/health-select.css">

<body onload="initParameter(${requestScope.asideStatus},${requestScope.healthAttributesPageInfo.currentPage})">
<!--顶栏-->
<header>
    <!--网站顶栏标题-->
    <span id="font">
        <h1 id="first">Re</h1>
        <h1 id="second">new</h1>
    </span>
    <!--网站顶栏头像-->
    <div id="user">

        <img src="../${sessionScope.user.userImg}">
        <!--下拉框和点击下拉按钮-->
        <div class="dropdown">
            <span class="dropBtn">${sessionScope.user.userName}</span>
            <div class="dropdown-content">
                <a href="${pageContext.request.contextPath}/loginOut">退出登录</a>
                <a href="#">个人信息</a>
            </div>
        </div>
    </div>
</header>
<!--边栏-->
<aside>
    <div class="tab_list">
        <ul class="aside">
            <li id="aside1"><a href="${pageContext.request.contextPath}/healthSelect">健康查询</a></li>
            <li id="aside2"><a href="${pageContext.request.contextPath}/medicalSearch">体检预约</a></li>
            <li id="aside3"><a href="${pageContext.request.contextPath}/editInformation">信息修改</a></li>
            <li id="aside4"><a href="${pageContext.request.contextPath}/DeleteOrderServlet?serviceType=2">我的订单</a></li>
        </ul>
    </div>
</aside>
<main>
    <div class="tab_con">
        <%--健康指标查询--%>
        <div class="item" id="item1">
            <div>
                <%--健康查询界面--%>
                <%--            <iframe align="center" width="100%" height="100%" src="../restrictedPages/health-select.jsp"  frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>--%>
                <div>
                    <form class="searchAttribute"
                          action="${pageContext.request.contextPath}/healthSelect?serviceType=search" method="get">
                        体检时间：
                        <input id="searchDate" type="date" name="searchExamineDate"
                               value="${requestScope.healthAttributesPageInfo.searchExamineDate}">
                        <input id="search" type="text" name="searchText" placeholder="请输入您要搜索的检查项..."
                               value="${requestScope.healthAttributesPageInfo.searchValue}"/>
                        <input id="searchButton" type="submit" value="搜索">
                    </form>
                </div>
                <div id="table">
                    <table width="90%" class="table">
                        <!--    <caption>-->
                        <!--    </caption>-->
                        <!--表格头部-->
                        <thead>
                        <tr>
                            <th>检查项</th>
                            <th>数据</th>
                            <th>结果</th>
                            <th>范围</th>
                            <th>体检时间</th>
                        </tr>
                        </thead>

                        <c:forEach var="healthAttribute" items="${requestScope.healthAttributesPageInfo.records}">
                            <tr>
                                <td>
                                        ${healthAttribute.attributeName}
                                </td>
                                <td>
                                        ${healthAttribute.attributeValue}
                                </td>
                                <td>
                                    <c:if test="${healthAttribute.consequence == 1}">
                                        <div id="iconHigh">偏高</div>
                                    </c:if>
                                    <c:if test="${healthAttribute.consequence == -1}">
                                        <div id="iconLow">偏低</div>
                                    </c:if>
                                    <c:if test="${healthAttribute.consequence == 0}">
                                        <div id="iconNormal">正常</div>
                                    </c:if>
                                </td>
                                <td>
                                        ${healthAttribute.attributeScope}
                                </td>
                                <td>
                                        ${healthAttribute.searchExamineDate}
                                </td>
                            </tr>
                        </c:forEach>
                    </table>
                </div>
                <ul class="pagination" id="healthSelectPage">
                    <label>总共 ${requestScope.healthAttributesPageInfo.totalCount} 条记录</label>
                    <%--                    <li><a href="#">«</a></li>--%>
                    <%--                    <li><a href="#">»</a></li>--%>
                    <c:forEach var="page" begin="${requestScope.healthAttributesPageInfo.navigateFirstPage}"
                               end="${requestScope.healthAttributesPageInfo.navigateLastPage}">
                        <li><a id="${page}"
                               href="${pageContext.request.contextPath}/healthSelect?searchText=${requestScope.healthAttributesPageInfo.searchValue}&currentPage=${page}&searchExamineDate=${requestScope.healthAttributesPageInfo.searchExamineDate}">${page}</a>
                        </li>
                    </c:forEach>
                </ul>
            </div>
        </div>
        <%--体检预约--%>
        <div class="item" id="item2" style="display: none">

            <div>

                <form id="bookForm" action="${pageContext.request.contextPath}/bookCombo">
                    套餐：
                    <div>
                        <select name="medicalPlanId" id="bookSelect" onchange="clickOption()">
                            <c:if test="${requestScope.asideStatus  == 2}">
                                <option id="#">选择您的套餐</option>
                                <!--varStatus ： 遍历对象的状态-->
                                <c:forEach var="examineOrder" items="${requestScope.examineOrderList}" varStatus="i">
                                    <c:choose>
                                        <c:when test="${requestScope.index == (i.index+1)}">
                                            <option selected id="${examineOrder.examineId}"
                                                    value="${examineOrder.examineId}">${examineOrder.examineCombo}</option>
                                        </c:when>
                                        <c:otherwise>
                                            <option id="${examineOrder.examineId}"
                                                    value="${examineOrder.examineId}">${examineOrder.examineCombo}</option>
                                        </c:otherwise>
                                    </c:choose>

                                </c:forEach>

                            </c:if>
                        </select>
                    </div>
                    <label id="bookTime">预约时间：</label>
                    <input type="date" name="bookTime" id="dataInput" value="请输入您要预约的时间">
                    <input type="submit" value="预定" id="bookButton">
                </form>
            </div>
            <div id="tableForAttribute">
                <table width="90%" class="table">
                    <!--    <caption>-->
                    <!--    </caption>-->
                    <!--表格头部-->
                    <thead>
                    <tr>
                        <th>检查项</th>
                        <th>范围</th>
                    </tr>
                    </thead>
                    <c:forEach var="attribute" items="${requestScope.attributesList}">
                        <tr>
                            <td>
                                    ${attribute.attributeName}
                            </td>
                            <td>
                                    ${attribute.attributeScope}
                            </td>
                        </tr>
                    </c:forEach>
                </table>

                <div id="priceItem">
                    <label id="price">${requestScope.price}</label>
                    <label id="symbol1">￥</label>
                    <label id="symbol2">实付：</label>
                </div>

            </div>
        </div>
        <%--用户个人信息修改--%>
        <div class="item" id="item3" style="display: none">
            <h1 align="center" style="color:black">个人信息修改页面</h1>
            <form action="${pageContext.request.contextPath}/sendInformation" style="width: 95%">
                <table class="informationTable">
                    <tr>
                        <td style=";width: 250px">用户ID：</td>
                        <td>
                            <input id="idText" type="text" disabled value="${requestScope.user1}">
                        </td>
                        <td style="width: 250px">性别：</td>
                        <td>
                            <select style="width: 96%" name="selectGender">
                                <c:if test="${requestScope.user.userGender == '男'}">
                                    <option value="男" selected>男</option>
                                    <option value="女">女</option>
                                </c:if>
                                <c:if test="${requestScope.user.userGender == '女'}">
                                    <option value="男">男</option>
                                    <option value="女" selected>女</option>
                                </c:if>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td>用户名：</td>
                        <td><input type="name" name="nameText" value="${requestScope.user.userAccount}"
                                   style="width:95%"></td>
                        <td>真实姓名：</td>
                        <td><input type="realname" name="realNameText" style="width:95%"
                                   value="${requestScope.user.userName}"></td>
                    </tr>
                    <tr>
                        <td>用户名密码：</td>
                        <td><input style="width: 95%; " type="text" name="passwordText"
                                   value="${requestScope.user.userPassword}"></td>
                        <td>头像</td>
                        <td><img src="${requestScope.user.userImg}" style="width: 30px"/></td>
                    </tr>

                    <td colspan="4" align="center">
                        <input class="submitButton" type="submit" value="提交">
                    </td>

                    </tr>
                </table>
            </form>
        </div>
        <%--用户订单--%>
        <div class="item" id="item4" style="display: none">
            <div>
                <h1 align="center" style="color:black">用户订单</h1>
                <table width="90%" class="table">
                    <c:forEach var="items" items="${comboForms}">
                        <tr>
                            <td>
                                    ${items.examineCombo}
                            </td>
                            <td>
                                    ${items.examinePrice}
                            </td>
                            <td>
                                    ${items.examineDate}
                            </td>
                            <td><input type="button" value="退单"
                                       onclick="deleteUserOrderByDeletebutton(${user.userId},${items.examineId},'${items.examineDate}')">
                            </td>
                        </tr>
                    </c:forEach>
                </table>
            </div>
        </div>
    </div>
</main>
<footer>

</footer>
</body>
<script src="../js/main.js"></script>
<script>
    <!--预约功能弹窗提示-->
    <c:if test="${requestScope.bookStatus == true}">
    window.alert("预约成功");
    window.location.href = "medicalSearch";
    </c:if>
    <c:if test="${requestScope.bookStatus == false}">
    window.alert("预约失败");
    window.location.href = "medicalSearch";
    </c:if>
    <c:if test="${requestScope.updateStatus == true}">
    window.alert("修改成功");
    window.location.href = "editInformation";
    </c:if>
</script>
</html>

